<template>
  <div class="utils-flex-Justend item-add" style="border-bottom: 1px solid #cccccc">
    <el-button type="primary" @click="goUrl">{{ text }}</el-button>
  </div>
</template>

<script>
import { useRouter } from 'vue-router';
export default {
  name: "itemAdd",
  props: {
    text: {
      default: "添加",
      type: String
    },
    url: {
      default: null
    },

  },
  setup(props,context) {
    const router = useRouter();
    const goUrl = () => {
      if(props.url === null) {
        context.emit('addClick')
      } else {
        router.push({
          path: props.url
        })
      }

    }
    return {
      goUrl
    }
  }
}
</script>

<style scoped lang="less">
.item-add {
  padding-bottom: 10px;
}
</style>